﻿/**
 * @name umi 的路由配置
 * @description 只支持 path,component,routes,redirect,wrappers,title 的配置
 * @param path  path 只支持两种占位符配置，第一种是动态参数 :id 的形式，第二种是 * 通配符，通配符只能出现路由字符串的最后。
 * @param component 配置 location 和 path 匹配后用于渲染的 React 组件路径。可以是绝对路径，也可以是相对路径，如果是相对路径，会从 src/pages 开始找起。
 * @param routes 配置子路由，通常在需要为多个路径增加 layout 组件时使用。
 * @param redirect 配置路由跳转
 * @param wrappers 配置路由组件的包装组件，通过包装组件可以为当前的路由组件组合进更多的功能。 比如，可以用于路由级别的权限校验
 * @doc https://umijs.org/docs/guides/routes
 */
export default [
  {
    path: '/',
    layout: false,
    component: '../components/BasicLayout/index',
    routes: [
      { path: '/', redirect: '/plaza' },
      {
        name: 'home',
        path: '/home',
        component: './Home/index',
      },
      {
        name: 'home',
        path: '/home/:searchstr',
        component: './Home/index',
      },
      {
        name: 'plaza',
        path: '/plaza',
        component: './Plaza/index',
      },
      {
        name: 'details',
        path: '/details',
        component: './Details/index',
      },
      {
        name: 'search',
        path: '/search',
        component: './Search/index',
      },
      {
        name: 'test',
        path: '/test',
        component: './Spice/components/passingTime/index',
      },
      {
        path: '/personalHomepage',
        routes: [
          { path: '/personalHomepage', redirect: '/personalHomepage/view' },
          {
            name: 'article',
            path: '/personalHomepage/view',
            component: './PersonalHomepage/index',
          },
          {
            name: 'article',
            path: '/personalHomepage/view/:id',
            component: './PersonalHomepage/index',
          },
        ],
      },
      // 文章内容展示
      {
        path: '/article',
        routes: [
          { path: '/article', redirect: '/article/view/:id' },
          {
            name: 'article',
            path: '/article/view/:id',
            component: './Article/index',
          },
        ],
      },
      // 服务条款
      {
        path: '/agreement',
        routes: [
          { path: '/agreement', redirect: '/agreement/view/:id' },
          {
            name: 'agreement',
            path: '/agreement/view/:id',
            component: './Agreement/index',
          },
        ],
      },
      // 集合门面
      {
        path: '/bookHome',
        routes: [
          { path: '/bookHome', redirect: '/bookHome/view/:id' },
          {
            name: 'bookHome',
            path: '/bookHome/view/:id',
            component: './BookHome/index',
          },
        ],
      },
    ],
  },
  {
    path: '/login',
    layout: false,
    routes: [
      { path: '/login', redirect: '/login/index' },
      {
        name: 'login',
        path: '/login/index',
        component: './User/Login/index',
      },
    ],
  },
  {
    path: '/qqlogin',
    layout: false,
    routes: [
      { path: '/qqlogin', redirect: '/qqlogin/index' },
      {
        name: 'qqlogin',
        path: '/qqlogin/index',
        component: './QQLogin/index',
      },
    ],
  },
  { path: '/admin', redirect: '/admin/home' },
  {
    path: '/admin/home',
    name: '用户首页',
    icon: 'HomeOutlined',
    component: './Admin/Home/index',
  },
  {
    path: '/admin/articlemanage',
    name: '文章管理',
    icon: 'table',
    routes: [
      { path: '/admin/articlemanage', redirect: '/admin/articlemanage/articles' },
      {
        path: '/admin/articlemanage/articles',
        hideChildrenInMenu: true,
        name: '文章列表',
        routes: [
          {
            path: '/admin/articlemanage/articles',
            redirect: '/admin/articlemanage/articles/list',
          },
          {
            path: '/admin/articlemanage/articles/list',
            name: '文章列表',

            component: './Admin/Article/index',
          },
          {
            path: '/admin/articlemanage/articles/add',
            name: '新增文章',
            component: './Admin/Article/add',
          },
          {
            path: '/admin/articlemanage/articles/edit/:id',
            name: '文章编辑',
            component: './Admin/Article/add',
          },
        ],
      },
      {
        path: '/admin/articlemanage/history',
        hideChildrenInMenu: true,
        name: '历史记录',

        routes: [
          {
            path: '/admin/articlemanage/history',
            redirect: '/admin/articlemanage/history/list',
          },
          {
            path: '/admin/articlemanage/history/list',
            name: '历史记录',
            component: './Admin/HistoryRecord/index',
          },
        ],
      },
    ],
  },
  {
    path: '/admin/collect',
    name: '我的收藏',
    icon: 'FolderOpenOutlined',
    hideChildrenInMenu: true,
    routes: [
      { path: '/admin/collect', redirect: '/admin/collect/mycollect' },
      {
        path: '/admin/collect/mycollect',
        name: '我的收藏',
        component: './Admin/MyCollect/index',
      },
    ],
  },
  {
    path: '/admin/bookstore',
    name: '我的书籍',
    icon: 'FolderOpenOutlined',
    hideChildrenInMenu: true,
    routes: [
      { path: '/admin/bookstore', redirect: '/admin/bookstore/list' },
      {
        path: '/admin/bookstore/list',
        name: '书籍列表',
        component: './Admin/Bookstore/index',
      },
    ],
  },
  {
    path: '/admin/user',
    name: '个人设置',
    icon: 'SettingOutlined',
    routes: [
      { path: '/admin/user', redirect: '/admin/user/settings' },
      {
        path: '/admin/user/settings',
        name: '个人资料',
        hideChildrenInMenu: true,

        routes: [
          {
            path: '/admin/user/settings',
            redirect: '/admin/user/settings/profile',
          },
          {
            path: '/admin/user/settings/profile',
            name: '用户信息设置',
            component: './Admin/UserProfile/index',
          },
        ],
      },
      {
        path: '/admin/user/account',
        name: '账号设置',
        hideChildrenInMenu: true,
        routes: [
          {
            path: '/admin/user/account',
            redirect: '/admin/user/account/settings',
          },
          {
            path: '/admin/user/account/settings',
            component: './Admin/AccountSetting/index',
          },
          {
            path: '/admin/user/account/bindingtel',
            component: './Admin/BindingTel/index',
          },
        ],
      },
      {
        path: '/admin/user/message',
        name: '消息设置',
        hideChildrenInMenu: true,

        routes: [
          {
            path: '/admin/user/message',
            redirect: '/admin/user/message/settings',
          },
          {
            path: '/admin/user/message/settings',
            name: '消息设置',
            component: './Admin/MessageSetting/index',
          },
        ],
      },
    ],
  },
  {
    path: '/qqbind',
    layout: false,
    routes: [
      { path: '/qqbind', redirect: '/qqbind/index' },
      {
        name: 'qqbind',
        path: '/qqbind/index',
        component: './Admin/QQBind/index',
      },
    ],
  },
  {
    name: 'spice',
    layout: false,
    path: '/spice',
    component: '../components/BasicLayout/index',
    routes: [
      { path: '/spice', redirect: '/spice/view' },
      {
        name: 'spice',
        path: '/spice/view',
        component: './Spice/index',
      },
      {
        name: 'offDutyCountdown',
        path: '/spice/offDutyCountdown',
        component: './Spice/components/offDutyCountdown/index',
      },
      {
        name: 'matterDemo',
        path: '/spice/matterDemo',
        component: './Spice/components/matterDemo/index',
      },
      {
        name: 'map',
        path: '/spice/map',
        component: './Spice/components/map/index',
      },
      {
        name: 'cron',
        path: '/spice/cron',
        component: './Spice/components/cron/index',
      },
    ],
  },
  {
    path: '*',
    layout: false,
    component: './404',
  },
];
